#Ifndef _EASYCKL
	#Define _EASYCKL
	
	#Ifdef __EC_LINUX_API
		#Include "ec_linux.bi"
	#EndIf
	
	#Inclib "EasyCKL"
	
	#Ifndef __ECKL_SRC_DEV_
		Type tagNEW_WINDOW_INFOMATION
			cbSize As SIZE_T
			lpFrame As Any Ptr
			szNewWindowUrl As WString Ptr
			szCurrentWindowUrl As WString Ptr
			szTargetFrameName As WString Ptr
			bUserGesture As BOOL
			dwOpenDisposition As DWORD
		End Type
		Type NEW_WINDOW_INFOMATION As tagNEW_WINDOW_INFOMATION
		Type LPNEW_WINDOW_INFOMATION As tagNEW_WINDOW_INFOMATION Ptr
		
		' No node is selected.
		#define MENU_TYPEFLAG_NONE		0
		' The top page is selected.
		#define MENU_TYPEFLAG_PAGE		1
		' A subframe page is selected.
		#define MENU_TYPEFLAG_FRAME		2
		' A link is selected.
		#define MENU_TYPEFLAG_LINK		4
		' A media node is selected.
		#define MENU_TYPEFLAG_MEDIA		8
		' There is a textual or mixed selection that is selected.
		#define MENU_TYPEFLAG_SELECTION	16
		' An editable element is selected.
		#define MENU_TYPEFLAG_EDITABLE	32
		
		Type tagRBUTTON_DOWN_INFOMATION
			cbSize As SIZE_T
			dwFlag As DWORD
			lpFrame As Any Ptr
			szSelectionText As WString Ptr
			szLinkUrl As WString Ptr
			szSourceUrl As WString Ptr
			Retention As Any Ptr
		End Type
		Type RBUTTON_DOWN_INFOMATION As tagRBUTTON_DOWN_INFOMATION
		Type LPRBUTTON_DOWN_INFOMATION As tagRBUTTON_DOWN_INFOMATION Ptr
		
		Type tagERROR_INFOMATION
			cbSize As SIZE_T
			lpFrame As Any Ptr
			bCertError As BOOL
			iErrorCode As Integer
			szFailedUrl As WString Ptr
			lpSslInfo As Any Ptr
		End Type
		Type ERROR_INFOMATION As tagERROR_INFOMATION
		Type LPERROR_INFOMATION As tagERROR_INFOMATION Ptr
	#EndIf
	
	Type V8Handler_CallBack As Function(sname As WString Ptr, argu As Any Ptr, argu As Any Ptr) As BOOL
	Type Chrome_CallBack_V8 As Sub(context As Any Ptr)
	Type Chrome_CallBack_BrowserCreated As Sub(id As LONG_PTR, lpBrowser As Any Ptr)
	Type Chrome_CallBack_Error As Sub(id As LONG_PTR, uMsg As UINT_PTR, info As LPERROR_INFOMATION, not_used As UINT_PTR)
	Type Chrome_CallBack_ChUrl As Sub(id As LONG_PTR, url As WString Ptr)
	Type Chrome_CallBack_Download As Sub(id As LONG_PTR, url As WString Ptr)
	Type Chrome_CallBack_NewWindow As Function(id As LONG_PTR, uMsg As UINT_PTR, info As LPNEW_WINDOW_INFOMATION, not_used As UINT_PTR) As BOOL
	Type Chrome_CallBack_ChState As Function(id As LONG_PTR, isLoading As BOOL, canGoBack As BOOL, canGoForward As BOOL) As BOOL
	Type Chrome_CallBack_JSDialog As Sub(id As LONG_PTR, msg As WString Ptr)
	Type Chrome_CallBack_RButtonDown As Sub(id As LONG_PTR, uMsg As UINT_PTR, info As LPRBUTTON_DOWN_INFOMATION, not_used As UINT_PTR)
	Type Chrome_CallBack_ChTitle As Sub(id As LONG_PTR, text As WString Ptr)
	Type Chrome_CallBack_CanLoadUrl As Function(id As LONG_PTR, url As WString Ptr) As BOOLEAN
	Type Chrome_CallBack_CanClose As Function(id As LONG_PTR, uMsg As UINT_PTR, not_used As Any Ptr, not_used_ As UINT_PTR) As BOOLEAN
	
	Type Ec_GetSource_CallBack As Sub(lpContext As LPVOID, szSource As WString Ptr)
	
	#Ifndef __ECKL_SRC_DEV_
		Type tagBROWSER_CALLBACKS
			cbSize As SIZE_T
			created_callback As Chrome_CallBack_BrowserCreated
			churl_callback As Chrome_CallBack_ChUrl
			newwindow_callback As Chrome_CallBack_NewWindow
			download_callback As Chrome_CallBack_Download
			chstate_callback As Chrome_CallBack_ChState
			jsdialog_callback As Chrome_CallBack_JSDialog
			error_callback As Chrome_CallBack_Error
			rbuttondown_callback As Chrome_CallBack_RButtonDown
			chtitle_callback As Chrome_CallBack_ChTitle
			canloadurl_callback As Chrome_CallBack_CanLoadUrl
		End Type
		Type BROWSER_CALLBACKS As tagBROWSER_CALLBACKS
		Type LPBROWSER_CALLBACKS As tagBROWSER_CALLBACKS Ptr
		
		#define INITFLAG_NOSSL					&H1
		#define INITFLAG_CACHESTORAGE			&H2
		#define INITFLAG_SINGLEPROCESS			&H4
		#define INITFLAG_USECOMPATIBILITY		&H8
		#define INITFLAG_ENABLEHIGHDPISUPPORT	&H10
		#define INITFLAG_DISABLEGPU				&H20
		#define INITFLAG_EXTDATA				&H40
		#define INITFLAG_SETUSERAGENT			&H80
		#define INITFLAG_SETUSERAGENT			&H80
		#define INITFLAG_SETSUBPROCESS			&H100
	#EndIf
	
	Type tagINIT_EXTDATA
		cbSize As SIZE_T
		szUserAgent As WString Ptr
		szSubProcess As WString Ptr
	End Type
	Type INIT_EXTDATA As tagINIT_EXTDATA
	Type LPINIT_EXTDATA As tagINIT_EXTDATA Ptr
	
	#define BROWSERFLAG_SYNC					&H1
	#define BROWSERFLAG_HEADER_REFERER			&H2
	#define BROWSERFLAG_DISABLE_JAVASCRIPT		&H4
	#define BROWSERFLAG_DISABLE_LOAD_IMAGE		&H8
	#define BROWSERFLAG_DISABLE_WEB_SECURITY	&H10
	#define BROWSERFLAG_EXTDATA					&H20
	#define BROWSERFLAG_DEF_ENCODING			&H40
	#define BROWSERFLAG_BACK_COLOR				&H80
	#define BROWSERFLAG_DEF_FONT				&H100
	#define BROWSERFLAG_DEF_FONT_SIZE			&H200
	
	#Ifndef __ECKL_SRC_DEV_
		Type tagCREATE_BROWSER_EXTDATA
			cbSzie As SIZE_T
			szDefaultEncoding As WString Ptr
			dwBackColor As DWORD
			szDefaultFont As WString Ptr
			dwDefaultFontSize As DWORD
		End Type
		Type CREATE_BROWSER_EXTDATA As tagCREATE_BROWSER_EXTDATA
		Type LPCREATE_BROWSER_EXTDATA As tagCREATE_BROWSER_EXTDATA Ptr
	#EndIf
	
	Type _tagCOOKIE_DESCRIPTOR
		cbSize As SIZE_T
		dwRetention As DWORD
		szCookieName As WString Ptr
		szCookieValue As WString Ptr
		szCookieDomain As WString Ptr
		szCookiePath As WString Ptr
		bHasExpires As BOOL
		bSecure As BOOL
		bHttponly As BOOL
		iExpiresYear As Integer
		iExpiresMonth As Integer
		iExpiresDayOfWeek As Integer
		iExpiresDayOfMonth As Integer
		iExpiresHour As Integer
		iExpiresMinute As Integer
		iExpiresSecond As Integer
		iExpiresMillisecond As Integer
	End Type
	Type COOKIE_DESCRIPTOR As _tagCOOKIE_DESCRIPTOR
	Type LPCOOKIE_DESCRIPTOR As _tagCOOKIE_DESCRIPTOR Ptr
	
	Enum BrowserInfomationType
		BrowserInfomationUserDataLoogPtr = 0,
		BrowserInfomationCanGoBack = 1,
		BrowserInfomationCanGoForward = 2,
		BrowserInfomationMainFrame = 3,
		BrowserInfomationIsLoading = 4,
		BrowserInfomationLastError = 5,
		BrowserInfomationBrowserId = 6
	End Enum
	
	#Ifndef __ECKL_SRC_DEV_
		#define BROWSER_LASTERROR_LOADING		&H1
		#define BROWSER_LASTERROR_LOADERROR		&H2
		#define BROWSER_LASTERROR_LOADRESERROR	&H4
		#define BROWSER_LASTERROR_CERTERROR		&H8
	#EndIf
	
	Extern "Windows"
		Declare Function Chrome_IsUIThread() As BOOL
		Declare Function Chrome_Initialize(hInstance As HINSTANCE, nossl As BOOL, cacheStorage As BOOL) As Integer
		Declare Function Chrome_InitializeEx(hInstance As HINSTANCE, dwFlags As DWORD, lpExtData As LPINIT_EXTDATA, szLocal As WString Ptr, szCachePath As WString Ptr) As Integer
		
		Declare Function Chrome_CreateChildBrowser(dwFlags As DWORD, lpCallbacks As LPBROWSER_CALLBACKS, id As DWORD, szHeaderReferer As WString Ptr, szUrl As WString Ptr, hParent As HWND, rcBrowserRect As RECT Ptr, lpExtData As LPCREATE_BROWSER_EXTDATA) As Any Ptr
		
		Declare Sub Chrome_DoMessageLoopWork()
		Declare Sub Chrome_MessageLoop()
		Declare Sub Chrome_QuitMessageLoop()
		Declare Sub Chrome_Shutdown()
		Declare Sub Chrome_SetUserAgent(ua As WString Ptr)
		Declare Sub Chrome_SetProxyServer(proxy As WString Ptr)
		Declare Sub Chrome_LoadUrl(lpBrowser As Any Ptr, url As WString Ptr)
		Declare Function Chrome_Window(lpBrowser As Any Ptr) As HWND
		Declare Sub Chrome_GoBack(lpBrowser As Any Ptr)
		Declare Sub Chrome_GoForward(lpBrowser As Any Ptr)
		Declare Sub Chrome_Refresh(lpBrowser As Any Ptr)
		Declare Sub Chrome_RefreshIgnoreCache(lpBrowser As Any Ptr)
		Declare Sub Chrome_Stop(lpBrowser As Any Ptr)
		Declare Sub Chrome_SetFocus(lpBrowser As Any Ptr, bFocus As BOOLEAN)
		Declare Sub Chrome_ExecJS(lpBrowser As Any Ptr, szJavaScript As WString Ptr)
		Declare Sub Chrome_EnableCookieStorageEx(CookiePath As WString Ptr)
		Declare Sub Chrome_EnableCookieStorage()
		Declare Sub Chrome_DisableCookieStorage()
		Declare Sub Chrome_CookieManagerFlushStore()
		
		Declare Function Chrome_CookieManagerSetCookie(szUrl As WString Ptr, lpCookieDescriptor As LPCOOKIE_DESCRIPTOR) As BOOL
		Declare Function Chrome_CookieManagerDeleteCookie(szUrl As WString Ptr, szCookieName As WString Ptr) As BOOL
		Declare Sub Chrome_Close(lpBrowser As Any Ptr)
		Declare Sub Chrome_SetV8ContextCallback(contextcreate As Chrome_CallBack_V8, hdr As V8Handler_CallBack)
		Declare Sub Chrome_SetOSModalLoop(osModalLoop As BOOLEAN)
		Declare Function Chrome_GetUrlLength(lpBrowser As Any Ptr) As DWORD
		Declare Sub Chrome_GetUrlString(lpBrowser As Any Ptr, buffer As WString Ptr, buffer_length As DWORD)
		Declare Sub Chrome_LoadString(lpBrowser As Any Ptr, s As WString Ptr, url As WString Ptr)
		Declare Function Chrome_GetWindowHandle(lpBrowser As Any Ptr) As HWND
		Declare Sub Chrome_EnableSystemFlash()
		Declare Sub Chrome_LoadFlashPlugin(ppapi_flash_path As WString Ptr, ppapi_flash_version As WString Ptr)
		Declare Sub Chrome_ShowDevTools(lpBrowser As Any Ptr)
		Declare Sub Chrome_ShowDevToolsChild(lpBrowser As Any Ptr, hParent As HWND, rect As RECT Ptr)
		Declare Sub Chrome_SetUserDataLongPtr(lpBrowser As Any Ptr, dat As LONG_PTR)
		Declare Sub Chrome_PrintToPDF(lpBrowser As Any Ptr, pdf_path As WString Ptr)
		Declare Function Chrome_GetZoomLevel(lpBrowser As Any Ptr) As Double
		Declare Sub Chrome_SetZoomLevel(lpBrowser As Any Ptr, dbZoomLevel As Double)
		Declare Function Chrome_DataURIBase64Encode(lpData As Byte Ptr, dwSize As DWORD, szMimeType As WString Ptr, szCharset As WString Ptr) As WString Ptr
		Declare Sub Chrome_ReleaseBuffer(lpBuffer As Any Ptr)
		
		Declare Sub Chrome_GetHtmlSource(lpBrowser As Any Ptr, lpContext As LPVOID, lpCallbackFunction As Ec_GetSource_CallBack)
		
		Declare Sub Chrome_QueryBrowserInfomation(lpBrowser As Any Ptr, Tpe As BrowserInfomationType, buffer As Any Ptr)
		
		Declare Function EcKeInitialize(hInstance As HINSTANCE, flag As DWORD, Local As WString Ptr, cache_path As WString Ptr, recvd As Any Ptr) As Integer
		Declare Sub EcKeCookieStorageControl(enable As BOOL, CookiePath As WString Ptr, persist_session_cookies As BOOL)
		
		#Ifndef __EC_PACK_API_CPP_
			Declare Sub EcPkHtmlRefreshContentJumpUrl(lpBrowser As Any Ptr, url As WString Ptr, referer As WString Ptr)
			Declare Function EcPkCreateJSRefererBrowserSync(id As DWORD, hParent As HWND, rect As RECT Ptr, url As WString Ptr, referer As WString Ptr, callbacks As LPBROWSER_CALLBACKS) As Any Ptr
			Declare Sub EcPkDisableDragDrop(lpBrowser As Any Ptr)
			Declare Sub EcPkJavaScriptSetValueByObjectId(lpBrowser As Any Ptr, id As WString Ptr, value As WString Ptr)
			Declare Sub EcPkJavaScriptSetValueByObjectName(lpBrowser As Any Ptr, sname As WString Ptr, value As WString Ptr)
			Declare Sub EcPkJavaScriptSubmitByFormId(lpBrowser As Any Ptr, id As WString Ptr)
			Declare Sub EcPkJavaScriptSubmitByFormName(lpBrowser As Any Ptr, sname As WString Ptr)
			Declare Sub EcPkJavaScriptSetCheckedByObjectId(lpBrowser As Any Ptr, id As WString Ptr, checked As BOOLEAN)
			Declare Sub EcPkJavaScriptSetCheckedByObjectName(lpBrowser As Any Ptr, sname As WString Ptr, checked As BOOLEAN)
			Declare Sub EcPkJavaScriptClickButtonByObjectId(lpBrowser As Any Ptr, id As WString Ptr)
			Declare Sub EcPkJavaScriptClickButtonByObjectName(lpBrowser As Any Ptr, sname As WString Ptr)
		#EndIf
		
		#Ifndef __EC_CUSTOMIZE_JS_CPP_
			Declare Sub Chrome_AddJSFunction(context As Any Ptr, sname As WString Ptr)
			Declare Function Chrome_GetV8ValueListSize(arguments As Any Ptr) As DWORD
			Declare Function Chrome_GetV8ValueInt(arguments As Any Ptr, ipos As SIZE_T) As DWORD
			Declare Function Chrome_GetV8ValueStringLength(arguments As Any Ptr, ipos As SIZE_T) As DWORD
			Declare Sub Chrome_GetV8ValueString(arguments As Any Ptr, ipos As size_t, buffer As WString Ptr, buffer_length As SIZE_T)
			Declare Sub Chrome_SetV8ReturnValueInt(lpretval As Any Ptr, value As Integer)
			Declare Sub Chrome_SetV8ReturnValueString(lpretval As Any Ptr, value As WString Ptr)
		#EndIf
		
		#Ifndef __EC_FRAME_API_CPP_
			Declare Sub Chrome_FrameLoadUrl(frame As Any Ptr, url As WString Ptr)
			Declare Sub Chrome_FrameLoadString(frame As Any Ptr, pstr As WString Ptr, url As WString Ptr)
			Declare Sub Chrome_FrameIsMain(frame As Any Ptr)
			Declare Sub Chrome_ReleaseFrame(frame As Any Ptr)
			Declare Function Chrome_GetNameFrame(lpBrowser As Any Ptr, sname As WString Ptr) As Any Ptr
			Declare Function EcQBIGetMainFrame(lpBrowser As Any Ptr) As Any Ptr
			Declare Function Chrome_FrameGetUrl(lpFrame As Any Ptr) As WString Ptr
			Declare Sub Chrome_FrameDoCopy(frame As Any Ptr)
			Declare Sub Chrome_FrameDoCut(frame As Any Ptr)
			Declare Sub Chrome_FrameDoDelete(frame As Any Ptr)
			Declare Sub Chrome_FrameDoPaste(frame As Any Ptr)
			Declare Sub Chrome_FrameDoSelectAll(frame As Any Ptr)
		#EndIf
		
		#Ifndef __EC_CUSTOMIZE_SCHEME_CPP_
			Type SchemeProcessRequest As Function(request As Any Ptr, Dat As Any Ptr, mime_type As Any Ptr, status As UInteger Ptr) As BOOLEAN
			
			Declare Sub Chrome_RegisterSchemeInitialize(callback As SchemeProcessRequest)
			Declare Sub Chrome_RegisterScheme(szSchemeName As WString Ptr, szDomainName As WString Ptr)
			Declare Function EcCSGetRequestUrlLength(lpRequest As Any Ptr) As SIZE_T
			Declare Sub EcCSGetRequestUrl(lpRequest As Any Ptr, lpUrlBuffer As WString Ptr, ulLength As ULong)
			Declare Function EcCSGetRequestHeaderStringLength(lpRequest As Any Ptr, szHeaderName As WString Ptr) As SIZE_T
			Declare Sub EcCSGetRequestHeaderString(lpRequest As Any Ptr, szHeaderName As WString Ptr, lpBuffer As WString Ptr, ulLength As ULong)
			Declare Function EcCSGetRequestPostDataSize(lpRequest As Any Ptr) As SIZE_T
			Declare Sub EcCSGetRequestPostData(lpRequest As Any Ptr, lpDataBuffer As Byte Ptr, notused As ULONG_PTR)
			Declare Sub EcCSSetData(lpData As Any Ptr, lpDataBuffer As ZString Ptr, nSize As SIZE_T)
			Declare Sub EcCSSetMimeType(lpMimeType As Any Ptr, szMimeType As WString Ptr)
			Declare Sub EcCSSetStatus(lpStatus As Integer Ptr, iStatus As Integer)
		#EndIf
		
	End Extern
	
	#Ifdef __EC_LINUX_API
		#Undef TRUE
		#Undef FALSE
	#EndIf
	
#EndIf
